package net.zdreamer.shunyi.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import net.zdreamer.shunyi.R;
import net.zdreamer.shunyi.utils.ImageUtil;
import net.zdreamer.shunyi.utils.ListUtils.PhotolistInfos;
import net.zdreamer.shunyi.utils.ViewHolder;

import java.util.List;

public class PhotoListAdapter extends MyBaseAdapter<PhotolistInfos.PhotolistInfo> {
    private Context context;
    public PhotoListAdapter(Context context, List<PhotolistInfos.PhotolistInfo> list, int res) {
        super(context, list, res);
        this.context=context;
    }

    @Override
    protected View getView(int position, View convertView, ViewGroup parent, PhotolistInfos.PhotolistInfo value) {
        ImageView photoitem = (ImageView) ViewHolder.get(convertView, R.id.photoimgs);
        photoitem.setImageBitmap(ImageUtil.toRoundBitmap(context, value.images.get(position).get("photo")));
        return convertView;
    }
}
